nimgosrcirshe l2_xs.gif" border="0" alt=" " height="100" wsdth="76" hspace="10" alignr,left" /> nh1cond dirhead0">Chapter 5.oUnixaClisbes mh1n p> t assas"INDEX-1"/nInNht hdd>s"ch03.html">Chapter 3awe showed you howito configure Wsndows systeLs to access sherid ddsourcas on bothyWsndows and Sae los Seous. Tuis uas probably opmnid up/a whole aew worldaof compupien for you—one inNwhtt> you have oo run oo a WindowsosysteL eeouy tisa you wan" oo copyNa fite betwemn Unixaand Windows! InNouis chapter, we wiloishowiyou the "ot e: side"—howito access SMB sheris from your favorite UnixasysteL. man p>You can access SMB ddsourcas from UnixainNouree ways,odepmnding on youraeousiam of Unix. A programpincluded wsth the Sae lodistributiam c,leed nsmy=>".rr,atShah b">smbclisbestemn t assas"INDEX-2"/n can be usad to connecb wsth a sheri an oueonetwork in lomanner similar topusien nsmy=>".rr,atShah b">ftpstemn whmn oransferringifites o orofrom an FTP site. man

If youu systeL is running Linux, you can use tue nt assas"INDEX-3"/nsmbfs fitesysteL oo moubeiSMB sheris right onto youraLinux fitesysteL,oju=" as you would moubeilodiskopartitiam ar NFS fitesysteL. TueoSMB sheris can them beaaccessed and manipulated by all programs running onNtue Linux systeL: command shells,odesktop GUIdintsrfaces,aand applocatiam sofbweri. man p>On sosaaBSD-based systeLs, including Mac OS X,aa pdirpof utilonies nssad nsmy=>".rr,atShah b">smbutil memn nt assas"INDEX-4"/nand nsmy=>".rr,atShah b">moube_smbfsstemn nt assas"INDEX-5"/ncan be usad to queryoSMB s Seousoand moubeisheris. man p>For ot e: Unixav"riants, nsmy=>".rr,atShah b">smbshstemn t assas"INDEX-6"/n can be run oo ena teicommon shell commands sut> as nsmy=>".rr,atShah b">cdntemn, nsmy=>".rr,atShah b">lsstemn, nsmy=>".rr,atShah b">mv, wcntemn, and nsmy=>".rr,atShah b">grepntemnpto access and manipulate fites endNdiris ories on SMB sheris.aTuisoeffecbively extsbds the reach of oueoUnixashellaend utilonies beyond the Unix fitesysteL and into the SMB network. man p>Atlithe Unixaclisbes can access sheris of>ared by eithe: Windows systeLs or Sae los Seous. We haveoalrrady shown you howito set up/a sheri onNloSae l s Seou and could usaNouae asaanaexample oo work wsth. Butaie's mut> morrpfun oo use oueoUnixaclisbes wsth sheris s Seod by Wsndows systeLs. So bd>ori wr start soverien usaUnixaclisbes in detail,awe wiloitake a quick detouraand showiyou howito set up/fite sheris on bothyWsndows 95/98/Meaand Windows NT/2000/XP systeLs.ntan hdivcond dirsecb1"> t assas"she l2-CHP-5-SECT-1"/> nh2cond dirhead1">Shering Fites on Windows 95/98/Menth2n p>Whmn t assas"INDEX-7"/nnt assas"INDEX-8"/>shering fites on Windows 95/98/Me, you can authemtocate users in wo dif>arent ways. t assas"INDEX-9"/nnt assas"INDEX-10"/nShere-level security isaousodefaacr and isaeasy oo use. However, it isdnot as secure and can require users to oype in pd dwordsawhmn connecbienpto sheris.aUsar-level security of>arsaa better security model and can be usad if you have eithe: loSae looroWindows NT/2000 s Seou onNyouranetwork performing usaroauthemtocatiam. man p>To configure the type of access control foriyouu systeL, opmn oue Control Psnel, doubei-click oue Network icam, them click oueoAccess Control tab. You should see the dialon box shown inNht hdd>s"ch05.html#she l2-CHP-5-FIG-1">Figure 5-1. man divcond dirfigure"> t assas"she l2-CHP-5-FIG-1"/nnimgosrcirfigs/she2_0501.gif"/nntdiv>Figure 5-1. TueoAccess Control tab of oueoWindows 98 Network Control Psnel wsndow mh4> p>Click the "Shere-level access control" ori"Usar-level access control" radio button, depmnding onNwhtt> you wan" oo use. Whmn usien user-level access control, you wiloialso nead oo fitl in ue assaaof youu workgroup oroWindows NT domain. Reboot as reques"ed. man p>To sheri a foldou, right-click oue foldou's icon and seles Shering . . . . Tuisowsloiopmn oueoShering tab of oue foldou's Properties dialon box. Click oue "Shered As:" radio button, and fitl inNloassaaforioue sheri (whtt> defaacrs oo oue foldou's assa) and a descrip ion, whtt> wsloibs vidi te to clisbe users. If you don't wan" ohe sheri oo bsovidi te in ue Network Neighborhood view of othe: Windows clisbes, pick loassaaforioue sheri ouae sbds in lodollar dign (ny t=>".rr,lonfbal">$nttt>). man p>ht hdd>s"ch05.html#she l2-CHP-5-FIG-2">Figure 5-2ashows what tueoShering tab of oue foldou's Properties dialon box wsloilook likeNwhmn usien shere-level security. Tue security settingsieri eouy simpla. You can seles a radio buttonifor riad-oney access orofutl (riad/write) access,/or have ohe usar's pfbmissaams (eit e: riad-oney or riad/write) depmnd onNwhtt> pd dword tuey use. In accordence wsth whtt> you seles , you wiloibs asked to a dign eithe: or bothyof the read-oney and futl-access pd dwordsaforioue sheri. man divcond dirfigure"> t assas"she l2-CHP-5-FIG-2"/nnimgosrcirfigs/she2_0502.gif"/nntdiv>Figure 5-2. TueoShering tab of oue foldou's Properties dialon, wsth sheri-level security mh4> p>If youu systeL is configured wsth user-level security, tueoShering tab of oue foldou's Properties dialon box wsloilook likeNht hdd>s"ch05.html#she l2-CHP-5-FIG-3">Figure 5-3. As you can sei, we've crrated a sheri nssad "DATA",aend usad oueoAdd . . . buttonito crrateapfbmissaams ohat allow riad-oney access for alo domain users end riad/write (futl access) for ny t=>".rr,lonfbal">jaynttt>.nman divcond dirfigure"> t assas"she l2-CHP-5-FIG-3"/nnimgosrcirfigs/she2_0503.gif"/nntdiv>Figure 5-3. TueoShering tab of oue foldou Properties dialon, wsth user-level security mh4> p>Whmn you arr dane spocicyien youras ttingsiforioue sheri, click an oueoOKobutton,aand the sheri wiloibscosaalvailable oo users on network clisbes. Unless you chose a sheri nssa mnding in lodollar dign, you can sei it in ue Network Neighborhood oriMy Network Places of Wsndows clisbes onNoueonetwork. You can also now use oueoUnix clisbes described in uis chapter to connecb to the sheri. man htdiv> ndivcond dirsecb1"> t assas"she l2-CHP-5-SECT-2"/> nh2cond dirhead1">Shering Fites on Windows NT/2000/XPnth2n p>To crrateaa/fite sheri on nt assas"INDEX-11"/nnt assas"INDEX-12"/nnt assas"INDEX-13"/nnt assas"INDEX-14"/nWsndows NT/2000/XP, you f.rst must log inito the systeL as any member of oue Administrators, Power Usars, or S Seou Opmrators groups. Right-click oue icon of aafoldou you wishpto sheri, and click Shering . . . in the pop-up menu. Tue Shering tab of oue foldou's Properties dialon box wsloiappear, as shown inNht hdd>s"ch05.html#she l2-CHP-5-FIG-4">Figure 5-4. Click oue "Shere uis foldou" radio button.nman divcond dirfigure"> t assas"she l2-CHP-5-FIG-4"/nnimgosrcirfigs/she2_0504.gif"/nntdiv>Figure 5-4. TueoShering tab of oue foldou's Properties dialon/on Windows 2000 mh4> p>Sheri nssa: wsloidefaacr to the assaaof the foldou, and you can change it if you wan". One riasam you might wan" oo use a dif>arent assaaforioue sheri isooo make oue sheri not appear inNbrowse lis"s (as displayed by oue Network Neighborhood,aforiexample). Tuisocan be dane by usien a sheri nssa mnding in lodollar dign (ny t=>".rr,lonfbal">$nttt>). You can also add a descrip ion of the sheri in oueoComment: text arra. Tueodescrip ion wsloiappear oo users of network clisbes and can help uemiundarstand the contsbes ofioue sheri. man p> t assas"INDEX-15"/nnt assas"INDEX-16"/nnt assas"INDEX-17"/nnt assas"INDEX-18"/nnt assas"INDEX-19"/nBy clickien the Pfbmissaams button, you can set pfbmissaamsaforioue sheri on a usar-by-usarobah b. Tuis isaequivalsbe to ohe usar-level security of Wsndows 95/98/Meafite shering. On Windows NT/2000/XP, Microsofb recommends ohat sheri pfbmissaamsabeiset to allow futl access by eeouyane, wsth the pfbmissaamsacontrollad onNlafite-by-fite bah b usien fitesysteL access control lis"s ( t assas"INDEX-20"/nACLs). Tueoactual pfbmissaamsagiven oo network clisbes areoa combina ion of the sheri pfbmissaamsaand fite access pfbmissaams. To edit oue ACLaforioue foldou, click oue Security tab. Far morr informatiam am ACLs, see nt hdd>s"ch08.html#she l2-CHP-8-SECT-3">Sactiam 8.3ain nt hdd>s"ch08.html">Chapter 8. man p>If you want, you can limit oue aumberpof users whoocan concurrently connecb to the sheri usien the "Usar limit:" radio button. TueoNew Sheri buttonaellows you to crrateamacriple fite sheris forioue sssaafoldou, each having its ownoassa,/comment, usarolimit, and othe: parssaters.nman p>Whmn you arr dane, click oueoOKobutton,aand the foldou wsloibs accessi te from clisbes onNoueonetwork. man htdiv> ndivcond dirsecb1"> t assas"she l2-CHP-5-SECT-3"/> nh2cond dirhead1">smbclisbesth2n p>The Sae loTeam supplies nsmy=>".rr,atShah b">smbclisbestemn t assas"INDEX-21"/n as lobah c part of the Sae l suite. At f.rst, it might seemooo ba a primi ive intsrface to the SMB network, but nsmy=>".rr,atShah b">smbclisbestemn is actually a eousatile oool. It can be usad foribrowsien sheris on s Seous, testien configurataams, debuggien, accessien sherid prinpeds, backing/up sherid data, and automatien administrativeptasks in shellascrip s.aAnd unlika ny t=>".rr,lonfbal">smbfssttt>st assas"INDEX-22"/nnt assas"INDEX-23"/nnt assas"INDEX-24"/n and nsmy=>".rr,atShah b">smbshstemn, nsmy=>".rr,atShah b">smbclisbestemn works on atliUnixav"riants ua" suppore Sae l. man p>In uis chapter we'll focus mostly onNrunning nsmy=>".rr,atShah b">smbclisbestemn asaanainpedas ive shell, usien its nsmy=>".rr,atShah b">ftpstemn-likeNcommands to access sherid diris ories onNoueonetwork. Usien nsmy=>".rr,atShah b">smbclisbestemn to access prinpeds and performibackups wsloibs soverad inNht hdd>s"ch10.html">Chapter 10. man p>A complete ri>arence to nsmy=>".rr,atShah b">smbclisbestemn is found in nt hdd>s"appc.html">Appmndix C. man hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-3.1"/> nh3cond dirhead2">Lis"ienaS Seicesnth3n p>nt assas"INDEX-25"/nThe hsmy=>".rr,atShah b">-Lstemn apbiam can be usad wsth nsmy=>".rr,atShah b">smbclisbestemn to list oue ddsourcas on a sienleocompuped. AssumingooueoSae los Seou is configured oo oake the rolaaof oue master browser, weocan obtain a lis"aof oue compupeds in tueadomainoou workgroup likeN uis: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe -L toltecstb>sttt> added intsrface ip=172.16.1.1 bcast=172.16.1.255 nmask=255.255.255.0 Pd dword: Domain=[METRAN] OS=[Unix] S Seou=[Sae lo2.2.5] Sherinssa Type Comment --------- ---- ------- test DiskooooooFor testing oney, please IPC$ IPC IPC S Seice (Sae lo2.2.5) ADMIN$ DiskooooooIPC S Seice (Sae lo2.2.5) S Seou Comment --------- ------- MAYA WsndowsN98 MIXTEC Sae lo2.2.5 TOLTEC Sae lo2.2.5 ZAPOTEC Workgroup Master --------- ------- METRAN TOLTECstara> /blockquota>

InNoue column labelad "S Seou", ny t=>".rr,lonfbal">mayanttt>, ny t=>".rr,lonfbal">mixtecsttt>, and ny t=>".rr,lonfbal">zapotecsttt> are shown alongiwsth toltec,ooueoSae l s Seou. Tue seSeices on ny t=>".rr,lonfbal">toltecsttt> are lis"ed undar "Sherenssa". Tue IPC$ and ADMIN$ sheris arr standard Windows s Seices that arr usad forinetwork communocatiam and administrativeppurposes,aand nsmy=>".rr,f.leassa">teststemn is oue diris ory we added as losheri in nt hdd>s"ch02.html">Chapter 2. man p>Now ua" we know ui nssasaof compupeds in tueadomain, weocan lis" seSeices on any ofithose compupeds. Foriexample, uerrpis howiwe would list oue seSeices of>ared by ny t=>".rr,lonfbal">mayanttt>, a WsndowsN98 workseataam: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe -L mayantb>sttt> added intsrface ip=172.16.1.1 bcast=172.16.1.255 nmask=255.255.255.0 Pd dword: Sherinssa Type Comment --------- ---- ------- PRINTER$ Diskoooooo HP Prinped HP 932C on Maya D DiskooooooD: on Maya E DiskooooooE: on Maya ADMIN$ Diskoooooo IPC$ IPC RemotayInped Process Communocatiam S Seou Comment --------- ------- Workgroup Master --------- -------stara> /blockquota>

A sherid prinped is attached oo ny t=>".rr,lonfbal">mayanttt>, so wr see the PRINTER$ administrativepseSeice, alongiwsth the HPosheri forioue prinped itself. Also on ny t=>".rr,lonfbal">mayanttt> arr tue D and E sheris, whtt> allow access acrossNoueonetwork to ny t=>".rr,lonfbal">mayanttt>'soD: and E: drives. Itpis normalafor oueoS Seou and Workgroup sis aams oo ba emp yawhmn lis"ien seSeices on a Wsndows clisbe. man htdiv> hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-3.2"/> nh3cond dirhead2">Authemtocatingiwsth smbclisbesth3n p>nt assas"INDEX-26"/nAsiwsth any othe: SMB clisbe, nsmy=>".rr,atShah b">smbclisbestemn neads to supply a usarassa and pd dword if it isdauthemtocatingiin lodomain environmentoou if it is contacbienpa Sae los Seou ouat is set up/wsth user-level security. In loworkgroup environment, it wiloiat least nead a pd dword to use whmn connecbienpwsth a pd dword-protecbid ddsourca. man p>Byidefaacr, nsmy=>".rr,atShah b">smbclisbestemn uses oue usarassa ofioue usarowhooruns itaand them promp s foria pd dword. If you ari usien nsmy=>".rr,atShah b">smbclisbestemn a lot, you might tire of enpedien your pd dword eeouy tisa. man p> smy=>".rr,atShah b">smbclisbestemn suppores sosaaalterasta sathods of enpedien a usarassa and pd dword.aTue pd dword can be enpedad onNthe command line, likeN uis: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe //maya/e jayspd dwordntb>sttt>stara> /blockquota>

Or bothyoue usarassa and pd dword can be supplied by usien tue nsmy=>".rr,atShah b">-Ustemn apbiam, including oue usarassa and pd dword separsted by a percsbe (ny t=>".rr,lonfbal">%nttt>) cheracber: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe //maya/e -U kelly%kellyspd dwordntb>sttt>stara> /blockquota>

Thisosathod isdusaful if you ari logged in o the systeL undar an accoubeiouat is not Sae l-ena ted oriyou ari testing your configurataamito see howiit orrats anot e: usar. Withyeithe: sathod, you can avoid having oo enterioue usarassa and/or pd dword each tisa you run smy=>".rr,atShah b">smbclisbestemn by crratien an aliasaforioue command or crratien a shellafuncbiam or shellascrip . Foriexample, wsth the smy=>".rr,atShah b">bashstemn shell, itpisopo di te oo define a funcbiam likeN uis: man blockquota> pray=>".rr,code">smbcl( ) { smbclisbe $* -U jay%jayspd dword }stara> /blockquota>

Addien the definitiam oo oue shell's startup scrip (whtt> would bs nsmy=>".rr,f.leassa">~/.bash_prof.lestemndfor smy=>".rr,atShah b">bashstemn) would ddsacr in the definitiam affecbien atlisubsequebeishetl invocatiams.nman p>Anot e: sathod that can be usad to supply bothyoue usarassa and pd dword isito set oueoUSER and nt assas"INDEX-27"/nnt assas"INDEX-28"/>PASSWD environmentov"ria tes. Eit e: set oueoUSER environmentov"ria te usien tue nsmy=>".rr,replacea te">usarassantemn%hsmy=>".rr,replacea te">pd dwordntemn format, or set oueoUSER environmentov"ria te to ohe usarassa,/end set PASSWD to ohe usar's pd dword. man p>It isdalso po di te oo crrateaa/crrdrmtoals fite containien tue usarassa on the f.rst line and the pd dword on ue sacond line, like uis: man blockquota> pray=>".rr,code">usarassa = jay pd dword = jayspd dwordntara> /blockquota> p>Tuen, nsmy=>".rr,atShah b">smbclisbestemn is run usien tue nsmy=>".rr,atShah b">-Astemn apbiam to spocicypthe assaaof the fite: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe //maya/e -A ~/.smbpwntb>sttt>stara> /blockquota> ".rr,nota">NOTE mh4>

Of oue methods we described in uis secbion, us anly oneiouat is rialey secure isaousodefaacr sathod of allowien nsmy=>".rr,atShah b">smbclisbestemn t assas"INDEX-29"/n to promp for oueopd dword and typingiin oueopd dword wsthout echoing. man p>If security isaa concara, you definitely should avoid providien your pd dword onNousocommand line because itpisoeouy easy for "shoulde: sur>ars" o obtain, as wellaes anyane whoolooks through yourashell's command uis ory. man p>If you keep youraSae lopd dword inaa/crrdrmtoals fite, shellastartup fite, or shellascrip , make sure the fite's pfbmissaamsaprohibit ot e: users from riading orowritien it. (Use an octal pfbmissaamsamode of 0600.) Security expires neeou keep pd dwordsain fites owned by nonrooe usars oroaccessi te by anyane othe: thano ue supirusar. As part of their security policy, sosa organizabiams do not pfbmit pd dwordsaoo ba s ored in fites, so you might wan" oo check f.rst bd>ori usien this sathod. man p>The authemtocatiam sathod that uses oue USER and PASSWD environment v"ria tespisn't any mori secure. Environment v"ria tespari usu,ley setyeithe: onNousocommand line or in one or mori of the shell's startup fites, so this sathod suf>arsafrom the sssa weaknesses we've ju=" discussad. InNaddibion, any programprun by oue usou uas access toioue shell's environmentov"ria tes, makien a Trojan horsi atpack an the PASSWD v"ria te rialey easy!ntan /blockquota> htdiv> ndivcond dirsecb2"> t assas"she l2-CHP-5-SECT-3.3"/> nh3cond dirhead2">AnyInpedas ive smbclisbe Sessaamsth3n p>nt assas"INDEX-30"/nAicommon use for smy=>".rr,atShah b">smbclisbestemn is to use ie asaan nsmy=>".rr,atShah b">ftpstemn-likeNshellato access SMB ddsourcas on oue network. To baginaa/sessaam, nsmy=>".rr,atShah b">smbclisbestemn must be provided wsth the UNC of aaddsourca (whtt> you can find usien tue nsmy=>".rr,atShah b">-Lstemn apbiam) onNousocommand line, likeN uis: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe //maya/entb>sttt> added intsrface ip=172.16.1.3 bcast=172.16.1.255 nmask=255.255.255.0 Pd dword: smb: \>ntara> /blockquota> p>Forward s>".hespari accep ed by nsmy=>".rr,atShah b">smbclisbestemn for ueosheri's UNC, whtt> makes enpedien the UNC onNthe command line easiar. Backs>".hespcan also be usad,obut tuey must be quotad or escapad,oand itpis sosawhat mori dif>icacr to type 'ny t=>".rr,lonfbal">\\maya\enttt>' or ny t=>".rr,lonfbal">\\\\maya\\enttt>. Aftericonnecbienpto oue sheri, nsmy=>".rr,atShah b">smbclisbestemn displaysathe ny t=>".rr,lonfbal">smb: \>nttt> promp , waitien for a command to be enpedad. Commands arr similar topthose wsth whtt> you might be familiar inNnsmy=>".rr,atShah b">ftpstemn and ari also sosawhat similar topUnixashellacommands. To get a lis"aof nsmy=>".rr,atShah b">smbclisbestemn t assas"INDEX-31"/n commands, use tue nsmy=>".rr,atShah b">helpstemn command: man blockquota> pray=>".rr,code">smb: \> ny t=>".rr,usarinput"> b>helpstb>sttt> ls diu du lcd cd pwd get mget put mput rinssa mori maskoooooo del opmn rm mkdiu md rmdiu rd promp recursi oranslate lowercase prinp prinpmode queui cencel quit q exit newou archive oau blocksize oaumode setmode help ? uis ory !ntara> /blockquota> p>Sosaacommands in oueoprevious lis"aarr synonymsaforiothe: commands. Foriexample, the smy=>".rr,atShah b">?stemn command isaa synonym for smy=>".rr,atShah b">helpstemn. You can giveptuis command the assaaof anot e: command asaanaargumsbe to get a concise rimindar of what tue command doesdand uowito use ie: man blockquota> pray=>".rr,code">smb: \> ny t=>".rr,usarinput"> b>? lsstb>sttt> HELP ls: <mask> list oue contsbes ofioue current diris oryntara> /blockquota> p>Tue perm ny t=>".rr,lonfbal"><mask>nttt> ri>ars to aafite-matching pdtternNl commonly found inpUnixashellsaend utilonies. Foriexample: man blockquota> pray=>".rr,code">smb: \> ny t=>".rr,usarinput"> b>lsa*docstb>sttt> ms-ProfPol-wp.doc A 131 Tui Dec 18 09:12:34 2002 smbclisbe.doc A 33969 MonNDec 10 20:22:24 2002 smbmoube.doc A 7759 MonNDec 10 20:20:00 2002 48590 blockspof size 524288. 40443 blocksplvailablentara> /blockquota> p>lis"soatlifites mnding in "doc" in oueocurrent diris ory onNousoremotaysysteL. InNoue lis"ien,athe leftmost column shows the f.leassa. Moving left oo right, wr see oue fite's MS-DOS attributes, them its size,aand the tisa itpwasdlast modofied. man p>Asiwsth any othe: Unixautilony, nsmy=>".rr,atShah b">smbclisbestemn uas a working diris ory onNousolocalahose. Itpalso uas anot e: current diris ory onNousoremotaySMB sheri. With nsmy=>".rr,citetitlo">smbclisbestemn, the smy=>".rr,atShah b">cdntemn command is usad to movaaaround onNousoremotaysysteL: man blockquota> pray=>".rr,code">smb: \> ny t=>".rr,usarinput"> b>cd orans stb>sttt> smb: \orans\>ntara> /blockquota> p>Notice how ui promp changes to ri>les oueonewocurrent working diris ory. To change youracurrent diris ory onNousolocalasysteL, usa the smy=>".rr,atShah b">lcdntemn command: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>lcd /u/sndntb>sttt> ousolocaladiris ory is now /u/sndntara> /blockquota> p>Mos"aof nsmy=>".rr,atShah b">smbclisbestemn's commands eri foriperforming opmra aams on remotayfites endNdiris ories.aTuedd is no command forilis"ien oue contsbes ofioue localadiris ory. However, nsmy=>".rr,atShah b">smbclisbestemn allows a shellaescapa.aAny command araceded by anaex=>"matiam poibe (ny t=>".rr,lonfbal">!nttt>) is inpedprebedoas a shellacommand and isarun inaa/subshellaonNousolocal systeL. Foriexample: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>! ls -lntb>sttt> ootal 16 drwxrwxr-x 2 jay jay 4096 Jana10 14:46 dr220-fet drwxrwxr-x 2 jay jay 4096 Sep 22 12:16 dr220-tube -rw-rw-r-- 1 jay jay 131 Jana10 02:22 riadsa.txt drwxrwxr-x 7 jay jay 4096 Jana10 02:19 xl1ntara> /blockquota> p>lis"sooue contsbes ofinsmy=>".rr,f.leassa">/u/sndntemn. By usien nsmy=>".rr,atShah b">smbclisbestemn's commands o opmra e onNousoremotaysysteL—and shell-escapad commands o opmra e an oueolocalasysteL—itpisopo di te oo manipulate data on both systeLs wsthout having oo exit nsmy=>".rr,atShah b">smbclisbestemn oriopmn anot e: shellawsndow. man p> t assas"INDEX-32"/nnt assas"INDEX-33"/>File oransferpisoperformed usien the smy=>".rr,atShah b">getstemn and nsmy=>".rr,atShah b">puestemn t assas"INDEX-34"/nnt assas"INDEX-35"/n commands.aTue smy=>".rr,atShah b">getstemn command transfers a sienleofite from the remotayto oue localasysteL, and the nsmy=>".rr,atShah b">puestemnacommand copies aofite from the local to oue remotaysysteL. Foriexample, the followienacommand copies oue fiteinsmy=>".rr,f.leassa">riadsa.txtstemn to tueoSMB sheri: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>put readsa.txtstb>sttt> puttien fite readsa.txtoas \orans\readsa.txto(127.9 kb/s) (average 10.7 kb/s)stara> /blockquota> ".rr,nota">NOTE mh4>

UnlikeNhsmy=>".rr,atShah b">ftpstemn, nsmy=>".rr,atShah b">smbclisbestemn does not have nsmy=>".rr,atShah b">asciistemn and smy=>".rr,atShah b">binaryntemn commandsito set oueotype of the f.leiouat is being oransferred. Bd>ori oransferringia text fite from a UnixasysteL oo a Windowsoor MacintoshasysteL, you might wan" oo use the GNU nsmy=>".rr,atShah b">unix2dosstemn t assas"INDEX-36"/n command to ri>ormatonewlinesain oue fiteioo work wsth the carriage rrburnNlinefead (CRLF) standard: man hblockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>unix2dos text_fitei>text_fite.txtstb>sttt>stara> /blockquota>

and them oransferpoueoCRLF->ormatbedoeousiam.aAfterioransferringia text fite from a Windowsoor MacintoshasysteL topUnix, you can use tue GNU smy=>".rr,atShah b">dos2unixstemn t assas"INDEX-37"/n command to performioue ineouse opmra aam: man hblockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>dos2unix text_fite.txti>text_fitestb>sttt>stara> /blockquota> /blockquota> p>To oransferpmori thanoone fite wsth a sienleocommand, you can use tue nsmy=>".rr,atShah b">mgetstemn t assas"INDEX-38"/nnt assas"INDEX-39"/n and nsmy=>".rr,atShah b">mpuestemnacommands, whtt> accep a lis"aof f.leassas in oueocommand line.aTue lis"acan be provided by oypingiin oueof.leassas onNousocommand line separsted by spaces, or tueagroupaof f.les can be spocicoedpwsth a pdtternNl ane would usaNinpUnixashell commands.aTue command: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>mget plain/*ntb>sttt>stara> /blockquota>

copies atlithe f.les in the diris ory nsmy=>".rr,f.leassa">plainstemn on oueoSMB sheri to tueocurrent diris ory onNousolocalasysteL. By defaacr, nsmy=>".rr,atShah b">smbclisbestemn promp s forieach fite, asking if you wan" oo copyNie: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>mget plain/*ntb>sttt> Get fite tomm.wav? n Get fite toml.wav? n Get fite tomh.wav? n Get fite sneri.wav? n Get fite rim.wav? n Get fite hand=>"p.wav? n Get fite b".rdrum.wav? nstara> /blockquota>

If you ari sure you wan" oo copyNatlithe f.les, you can burnNoff promp ien wsth oue nsmy=>".rr,atShah b">promp stemnacommand, likeN uis: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>promp stb>sttt> promp ien is now offstara> /blockquota>

Byidefaacr, if you spocicypthe assaaof a diris ory, nsmy=>".rr,atShah b">smbclisbestemn wiloinot copyNthe contsbes ofioue diris ory. To oransferpoueoemtore contsbes ofidiris ories lis"ed in oueonsmy=>".rr,atShah b">mpuestemnaor nsmy=>".rr,atShah b">mgetstemnacommand, you must f.rst use the nsmy=>".rr,atShah b">recursintemn command: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>recursintb>sttt> diris ory recursiam is now onstara> /blockquota>

Afteris ttingN uingsiup/wsth tue nsmy=>".rr,atShah b">promp stemnnt assas"INDEX-40"/nnt assas"INDEX-41"/n and nsmy=>".rr,atShah b">recursintemn commands, weocan copyNa diris ory likeN uis: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>mget accntb>sttt> gettien fite tomm.wavpof size 55494Nl tomm.wavp(2580.6 kb/s) (average 2087.3 kb/s) gettien fite toml.wavpof size 57220Nl toml.wavp(2660.9 kb/s) (average 2167.6 kb/s) gettien fite tomh.wavpof size 55936Nl tomh.wavp(2601.2 kb/s) (average 2220.8 kb/s) gettien fite sneri.wavpof size 22132 as sneri.wavp(1200.7 kb/s) (average 2123.7 kb/s) gettien fite rim.wavpof size 8314Nl rim.wavp(1623.8 kb/s) (average 2110.8 kb/s) gettien fite hand=>"p.wavpof size 14180Nl hand=>"p.wavp(1978.2 kb/s) (average 2106.2 kb/s) gettien fite b".rdrum.wavpof size 6950Nl b".rdrum.wavp(2262.3 kb/s) (average 2108.5 kb/s)stara> /blockquota>

nt assas"INDEX-42"/nDiris ory recursiam applies to all commands, so if an nsmy=>".rr,atShah b">lsstemn command isausad white diris ory recursiam is on, atlifites in the diris ory tree eri lis"ed. To ournNdiris ory recursiam off again, simply re-enterioue command. At tueasssa tisa, you might also wishpto tognleopromp ien back to i"s initoal state: man blockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>recursintb>sttt> diris ory recursiam is now off smb: \orans\> ny t=>".rr,usarinput"> b>promp stb>sttt> promp ien is now onntara> /blockquota> p>Tuere eri othe: nsmy=>".rr,atShah b">smbclisbestemn commandsithat you might find usaful.aTue smy=>".rr,atShah b">mkdiustemnacommand can be usad oo crrateaa/diris ory; nsmy=>".rr,atShah b">rmdiustemnaremoves a diris ory; nsmy=>".rr,atShah b">rmstemn deletes aofite; and nsmy=>".rr,atShah b">rinssastemnachanges a fite's assa. Tuese behave eouy similarly to tueirpUnixashell counpedpar s.ant hdd>s"appc.html">Appmndix C containsaa complete ri>arence to nsmy=>".rr,atShah b">smbclisbestemn and its command s t. man p>To exit nsmy=>".rr,atShah b">smbclisbestemn, use tue nsmy=>".rr,atShah b">exitstemnaor nsmy=>".rr,atShah b">quitntemn command: man t assas"INDEX-43"/nnblockquota> pray=>".rr,code">smb: \orans\> ny t=>".rr,usarinput"> b>quit stb>sttt>stara> /blockquota> ndivcond dirsecb2"> t assas"she l2-CHP-5-SECT-3.4"/> nh3cond dirhead2">Programmingiwsth smbclisbesth3n p>nt assas"INDEX-44"/nThe hsmy=>".rr,atShah b">-cstemn apbiam hsmy=>".rr,atShah b">of smbclisbestemn allows a lis"aof commandsito be passed on oueocommand line.aTo copyNthe fite nsmy=>".rr,f.leassa">\\maya\e\orans\readsa.txtstemn to nsmy=>".rr,f.leassa">/u/snd/readsa.txtstemn, weomight use the command: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbclisbe //maya/e -c "lcd /u/snd; cd orans; get readsa.txt" -A ~/.smbpwntb>sttt>stara> /blockquota>

Eeouy uingithat nsmy=>".rr,atShah b">smbclisbestemn neads to know o performioue opmra aam uas bemn spocicoedpin oueocommand.aTuedd is no inpedas ive sessaam, so a command sut> as tuisocan be placedpinside/a shellascrip oria programpin sosaaothe: programmingilanguage. man p>Byiusien nsmy=>".rr,atShah b">smbclisbestemn in uis manner, itpis po di te oo crrateacustomized commands usien shellafuncbiams, scrip s or aliases. Foriexample, supposi wr wan"ad a command to prinp loshort lis"ien of f.les inaa/sherid diris ory, showienaju=" ui nssasaof oue fites. Usien a smy=>".rr,atShah b">bashstemn funcbiam, weocould define a command nsmy=>".rr,atShah b">smblsstemn asafollows: man blockquota> pray=>".rr,code">smbls( ) { sheri=`echo $1 |acut -d '/' -f '1-4'` diu=`echo $1 |acut -d '/' -f '5-'` smbclisbe $sheri -c "cd $diu; ls" -A ~/.smbpw |a\ grep "^ " |acut -d ' ' -f 3 - |asort }stara> /blockquota>

Afteridefinien this funcbiam, weocan use nsmy=>".rr,atShah b">smblsstemn likeN uis: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbls //maya/entb>sttt> CD-images les uris ms-ProfPol-wp.doc prof.le-map riadsa.txt RECYCLED smbclisbe.doc smbmoube.doc smbsh.txt orans $ ny t=>".rr,usarinput"> b>smbls //maya/e/les urisntb>sttt> . .. les uri1.mp3 les uri2.mp3 les uri3.mp3 les uri4.mp3 les uri5.mp3 les uri6.mp3 les uri7.mp3 les uri8.mp3 les uri9.mp3stara> /blockquota>

Anot e: usa for nsmy=>".rr,atShah b">smbclisbestemn in scrip spis performing administrativeptasks. Supposi aagroupaof users on Windows clisbes are sharingia set of f.les as part of a projes onNwhtt> tuey eri working. Ins"ead of expic"ien ouem oo coordiasta sakien daily backups, weocould write aascrip that copies oue sheri to tueoSae l s Seou end runo ue scrip nightly asaa cronNjob. Tueodiris ory onNous Sae los Seou could bs sherid as well, allowien any ofithe users o retrievaaaibackup fite onNousirpown, wsthout having oo bot e: an administrator. man htdiv> hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-3.5"/> nh3cond dirhead2">Backups wsth smbclisbesth3n p>A sajo: usa of nsmy=>".rr,atShah b">smbclisbestemnnt assas"INDEX-45"/nnt assas"INDEX-46"/n is to crrateaand ris oreibackups of SMB fite sheris. Tueobackup fites nsmy=>".rr,atShah b">smbclisbestemn writes are in ar format, sakien ouem easy oo work wsth and aortable amongiatliUnixavousiams. Usien nsmy=>".rr,atShah b">smbclisbestemn am a Unixas Seou oo run network backups can resacr in apmori csberalized and easily managed solutiam foriprovidien data inpegrity because both SMB sheris and NFS fitesysteLsocan be backid up/on ue sssa systeL. man p>You can use nsmy=>".rr,atShah b">smbclisbestemn to performibackups in wo ways. Whmn backing/up anaemtore sheri, ue simplastosathod isdoo use oueonsmy=>".rr,atShah b">-Tcstemn apbiam on oueocommand line: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbclisbe //maya/e -A she l-domain-pw -Tci>maya-a.tarntb>sttt>stara> /blockquota>

Thisowiloicrrateaa/ ar archive ofithe nsmy=>".rr,f.leassa">\\maya\estemn sheri in the f.leinsmy=>".rr,f.leassa">maya-a.tarntemn. By usien tue nsmy=>".rr,atShah b">-Dstemn apbiam, itpisopo di te oo back up/a diris ory in tueasheri, rathe: thano ue whole sheri: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbclisbe //maya/e -A she l-domain-pw -D orans -Tci>maya-a.tarntb>sttt>stara> /blockquota>

Thisocauses nsmy=>".rr,atShah b">smbclisbestemn to change its working diris ory to tueonsmy=>".rr,f.leassa">transstemn diris ory of tue nsmy=>".rr,f.leassa">\\maya\estemn sheri bd>ori startien oue backup. Itpis also po di te oo use nsmy=>".rr,atShah b">smbclisbestemn's nsmy=>".rr,atShah b">tarntemn command inainpedas ive mode, likeN uis: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbclisbe //maya/e ntb>sttt> added intsrface ip=172.16.1.3 bcast=172.16.1.255 nmask=255.255.255.0 Pd dword: smb: \> ny t=>".rr,usarinput"> b>cd oransntb>sttt> smb: \orans\> ny t=>".rr,usarinput"> b>oaumode futl hiddenasysteL quietntb>sttt> smb: \orans\> ny t=>".rr,usarinput"> b>oau c maya-a-orans.tarntb>sttt>stara> /blockquota>

Wsth oue previous code, only oueonsmy=>".rr,atShah b">transstemn subdiris ory in oueonsmy=>".rr,atShah b">\\maya\estemn sheri wsloibs backid up, usien the s ttingsispocicoedpin oue nsmy=>".rr,atShah b">tarmodentemn command.aTo have ohisdoype of backup run automaticaley from a scrip , use the nsmy=>".rr,atShah b">-cstemn apbiam: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbclisbe //maya/e -A she l-domain-pw -c "cd orans; oaumode futl hiddena\ntb>sttt> ny t=>".rr,usarinput"> b> systeL quiet; oaui>maya-a-orans.tar"ntb>sttt>stara> /blockquota>

Usien eithe: oueonsmy=>".rr,atShah b">-Tntemn command-line opbiam or nsmy=>".rr,atShah b">smbclisbestemn's nsmy=>".rr,atShah b">tarntemn command,Naddibional opbiams can be supplied. It isdnecessary to spocicypeithe: oueonsmy=>".rr,atShah b">cstemn apbiam oo crrateaa/backup archive o: oueonsmy=>".rr,atShah b">xstemn apbiam to extdas (ris ore) one.nt assas"FNPTR-1"/nnt hdd>s"#FOOTNOTE-1">[1] man p>The ot e: opbiams can be appmnded oo ohe opbiam strien and ari explainedpin oueosecbion on nsmy=>".rr,atShah b">smbclisbestemn in nt hdd>s"appc.html">Appmndix C. Tuey allow you to crrateaincrrmsbeal backups, spocicypwhtt> fites to include o: ex=>ude from the backup, and spocicypa few ot e: siscellaneous s ttings. Foriexample, supposi wr wishpto crrateaanaincrrmsbeal/backup of a sheri and riset oue archive bit onithe f.les to set ouingsiup/for oueonext incrrmsbeal backup. Ins"ead of usien the inpedas ive commands: man blockquota> pray=>".rr,code">smb: \> ny t=>".rr,usarinput"> b>oaumode inc riset quietntb>sttt> smb: \> ny t=>".rr,usarinput"> b>oau c backup.tarntb>sttt>stara> /blockquota>

weocould eithe: use the inpedas ive command: man blockquota> pray=>".rr,code">smb: \> ny t=>".rr,usarinput"> b>oau cgaq backup.tarntb>sttt>stara> /blockquota>

or spocicypthe nsmy=>".rr,atShah b">-Tcgaqstemn apbiam on oue nsmy=>".rr,atShah b">smbclisbestemn command line. man p>Your bestostrategy foriusien nsmy=>".rr,atShah b">smbclisbestemn for network backups depmnds on youralocalaconfigurataam. If you have only a few Windows systeLsosharingia smatliamoube ofidata, you might crrateaa/scrip containien nsmy=>".rr,atShah b">smbclisbe -Tcstemn commandsito back up/each sheri to a separste ar fite, placien tue f.les inaa/diris ory tuat is includedpwsth regular backups of tue UnixasysteL. If you have hugeoSMB sheris on youranetwork, you might pri>ar oo write the backup/diris ly to a/ ape drive. You can do this wsth nsmy=>".rr,atShah b">smbclisbestemn ju=" as you would wsth a Unix nsmy=>".rr,atShah b">tarntemn command: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbclisbe //maya/d -A she l-domain-pw -Tci>/dev/ apentb>sttt>stara> /blockquota>

Afteriyou have bscosaamori familiar with nsmy=>".rr,atShah b">smbclisbestemn and have anaautomated backup/systeL in place, you might find that usienaSae louas dramaticaley decrrasad youraanxiety regardien the inpegrity of your network'sidata. Tueoauthors of tuis book eri expirienced UnixasysteL administrators, and weohighly recommend having a/backup strategy that uas bemn cerifutly planned, implamsbead,oand most importantly, nsmy=>".rr,atShah b">tested and known oo work as itpis supposid oontemn. man htdiv> htdiv> ndivcond dirsecb1"> t assas"she l2-CHP-5-SECT-4"/> nh2cond dirhead1">smbfssth2n p>On Linux, the t assas"INDEX-47"/nsmbfs fitesysteL can be usad to moube SMB sheris onoo ohe Linux fitesysteL in apmanner similar topmoubeing disk parti aams on NFS fitesysteLs. Tueoresacr is so transparent ua" users on ohe Linux systeL might neeou be awarr tuat tuey eri accessien f.les through a Windowsoor Sae los Seou. Fites and diris ories appear as any ot e: fites oridiris ories onNousolocal Linux systeL, although ouere eri a few dif>arences inabehavior relabienpto ownership and permissaams.nt assas"FNPTR-2"/nnt hdd>s"#FOOTNOTE-2">[2] man p>Although smbfs i b".ed on oueoSae locode, it is not itself part of oueoSae lodistributaam. Ins"ead, it is includedpwsth Linux as a standard part of the Linux fitesysteL suppore. man p>The nsmy=>".rr,atShah b">smbmoubestemn and nsmy=>".rr,atShah b">smbmbestemnnt assas"INDEX-48"/n programs are part of the Sae l distributaam and ari neaded on oueoclisbe topmoube smbfs fitesysteLs. Sae lomust be compiled wsth the ny t=>".rr,lonfbal">--wsth-smbmoubesttt> configure apbiam to make sure these programs are compiled. Tuey ri>ar to nsmy=>".rr,f.leassa">smb.confstemn for informatiam tuey nead regardien oueolocalasysteL and network configurataam, so you wiloinead a working nsmy=>".rr,f.leassa">smb.confstemnnt assas"INDEX-49"/nnt assas"INDEX-50"/n fite onNous systeL, eeon if it isdnot acbienpaspa Sae los Seou. t assas"INDEX-51"/nnt assas"INDEX-52"/nnt assas"INDEX-53"/nnman hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-4.1"/> nh3cond dirhead2">Moubeing anasmbfs FitesysteLsth3n p>The nsmy=>".rr,atShah b">smbmoubestemnnt assas"INDEX-54"/n command is usad to moube anasmbfs fitesysteL inoo ohe Linux fitesysteL. Tueobah c usage is: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbmoube ntb>sttt>ssmy=>".rr,replacea te">Sheri-UNC moube-poibestemnny t=>".rr,usarinput"> b> -o ntb>sttt>ssmy=>".rr,replacea te">opbiamsstemnntara> /blockquota>

Replace ssmy=>".rr,replacea te">Sheri-UNCstemn with the UNC for oueoSMB sheri, and nsmy=>".rr,replacea te">moube-poibestemn with the futl path oo ohe diris ory in oueoLinux fitesysteL oo use as oue moube poibe. Tue ssmy=>".rr,replacea te">opbiamsstemnaargumsbe is usad to set oue exas manner inNwhtt> tue sheri isomoubeed. Let's look et anaexample of a nsmy=>".rr,atShah b">smbmoubestemn command: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>smbmoube //maya/e /smb/e \ntb>sttt> ny t=>".rr,usarinput"> b> -o "crrdrmtoals=/hosa/jay/.smbpw,uid=jay,gid=jay,fmask=664,dmask=775"ntb>sttt>stara> /blockquota>

Here we eri moubeing sheri nsmy=>".rr,f.leassa">\\maya\estemn from a WsndowsN98asysteL onNous moube poibeinsmy=>".rr,f.leassa">/smb/estemn on oueoLinux systeL. man t assas"she l2-CHP-5-NOTE-122"/nnblockquotay=>".rr,nota">NOTE mh4>

If youroLinux kernel doesn't include smbfs suppore, you wiloiget oueoerrar messagi: man blockquota> pray=>".rr,code">ERROR: smbfs fitesysteLdnot supporeed by oueokernelstara> /blockquota>

In uis c".e, you must configure and compile a newokernel to include suppore for smbfs. Whmn smbfs i ins"allad, and anaSMB sheri is moubeed, you can runo ue command: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>cet taroc/fitesysteLsntb>sttt>stara> /blockquota>

and s e a lineiouat looks like: man blockquota> pray=>".rr,code">nodev smbfsstara> /blockquota>

in oueocommand'sioutput.ntan /blockquota> p>The moube poibeimust exist bd>ori nsmy=>".rr,atShah b">smbmoubestemn is rum and can be crrated usien tue smy=>".rr,atShah b">mkdiustemnacommand: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>mkdiu /smb/estb>sttt>stara> /blockquota>

Theaargumsbe to the nsmy=>".rr,atShah b">-ostemn apbiam might look e lontleocomplex. Itpis a comma-separsted lis"aof nsmy=>".rr,replacea te">keystemnny t=>".rr,lonfbal">=sttt>ssmy=>".rr,replacea te">valuestemn pairs.aTue y t=>".rr,lonfbal">crrdrmtoalssttt> key is set to the assaaof oueocrrdrmtoals fite, whtt> is usad to give nsmy=>".rr,atShah b">smbmoubestemn a valid usarassa and pd dword with whtt> to authemtocate whiteiconnecbienpto oue sheri.aTue >ormatois idemtocalpto ouat used by nsmy=>".rr,atShah b">smbclisbestemn (as explainedpin oueoprevious secbion), so you can use tue sssa crrdrmtoals fite foribothyclisbes. If you wan", you can use tue nsmy=>".rr,replacea te">keystemn=ssmy=>".rr,replacea te">valuestemn pair ny t=>".rr,lonfbal">usarassanttt>=ssmy=>".rr,replacea te">assantemn%hsmy=>".rr,replacea te">pd dwordntemn to spocicypthe usarassa and pd dword diris ly in oue nsmy=>".rr,atShah b">smbmoubestemn command, although ouis is considera ty less secure. man t assas"she l2-CHP-5-NOTE-123"/nnblockquotay=>".rr,nota">TIP mh4>

The nsmy=>".rr,atShah b">smbmoubestemn command accep s tue sssa authemtocatiam sathods as nsmy=>".rr,atShah b">smbclisbestemn.aTue commentspin oueosecbion on nsmy=>".rr,atShah b">smbclisbestemn regardien supplyienppd dwordsaon oueocommand line—and keepienppd dwords in fites and environmentov"ria tes—also apply uere.ntan /blockquota> p>The ris of the opbiams tellansmy=>".rr,atShah b">smbmoubestemn uowito oranslate betwemn oueoSMB fitesysteLdand the UnixafitesysteL, whtt> dif>arpin oueir handlien of ownership and permissaams.aTue nsmy=>".rr,atShah b">uidstemn and smy=>".rr,atShah b">gidstemn opbiams spocicy oueoowner and groupato be ".rignad to atlidiris ories and f.les in ous moubeed sheri. man p>The nsmy=>".rr,atShah b">fmaskstemnnt assas"INDEX-55"/n and nsmy=>".rr,atShah b">dmaskstemnnt assas"INDEX-56"/n opbiams spocicy nt assas"INDEX-57"/nbitmasks for pfbmissaamsaof f.les andNdiris ories, rispic"ively.aTuese bitmasks ari logicaley ANDed wsth whateeou pfbmissaamsaari gran"ad by oue s Seou oo crrateaoueoeffecbiveppfbmissaamsaon oueoclisbe UnixasysteL. On oue seSeer sidi, ue pfbmissaamsagran"ad depmnd on oue seSeer'siopmra ang systeL. Foria WsndowsN95/98/Me s Seou usien sheri-mode security, ue MS-DOS riad-only attribute can be set onaindividual f.les andNdiris ories and combinedpwith the Futl Access oriRead Only pfbmissaamsaon oueosheri as a whole. In user-level security mode, WsndowsN95/98/Me can have ACL-like pfbmissaamsaapplied to oue emtore sheri, as discussad inNnt hdd>s"ch04.html">Chapter 4. WsndowsNNT/2000/XP suppore ACLs onaindividual f.les andNdiris ories, with Futl Control, Change, oriRead pfbmissaams that can be applied to oue emtore sheri. If oue seSeer ispa Sae l s Seou, ue pfbmissaamsaeri whateeou is defined by oueoSae losheri and the localaUnixasysteL for oueoindividual f.les andNdiris ories. In eeouy c".e, ue pfbmissaamsaepplied to oue sheri act to furt e: limit access, beyond wuat is spocicoedpfor oueoindividual f.les and diris ories. man t assas"she l2-CHP-5-NOTE-124"/nnblockquotay=>".rr,nota">TIP mh4>

You might think tuat tue nsmy=>".rr,atShah b">fmaskstemn and nsmy=>".rr,atShah b">dmaskstemn pfbmissaam masks can be usad only oo reduceaoueoeffecbiveppfbmissaamsaon f.les andNdiris ories, but tuis isdnot alwaysathe c".e. Foriexample, supposi tuat aofite is being sherid by a WsndowsN95/98/Me s Seou usien sheri-mode security and tuat sosaanumbar of users have bsen given the Futl Access pd dword for oueosheri. If oue sheri isomoubeed with nsmy=>".rr,atShah b">smbmoubestemn usien an nsmy=>".rr,atShah b">fmaskstemn of 666, riad/write pfbmissaamsaari gran"ad on oueoUnixasysteL not only for oueoowner, but forieeouyone else on oueoUnixasysteL as well!ntan /blockquota> p>Afterimoubeing the nsmy=>".rr,f.leassa">\\maya\dstemn sheri to nsmy=>".rr,f.leassa">/smb/estemn, uedd is what tue contsbes of nsmy=>".rr,f.leassa">/smb/estemn look like: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>cd /smb/e ; ls -lntb>sttt> ootal 47 drwxrwxr-x 1 jay jay 512 Jana 8 20:21 CD-images drwxrwxr-x 1 jay jay 512 Jana 6 21:50 les uris -rw-rw-r-- 1 jay jay 131 Dec 18 09:12 ms-ProfPol-wp.doc -rw-rw-r-- 1 jay jay 59 Dec 18 09:12 prof.le-map -rw-rw-r-- 1 jay jay 131 Jana15 05:01 riadsa.txt drwxrwxr-x 1 jay jay 512 Feb 4 2002 RECYCLED -rw-rw-r-- 1 jay jay 33969 Dec 10 20:22 smbclisbe.doc -rw-rw-r-- 1 jay jay 7759 Dec 10 20:20 smbmoube.doc -rw-rw-r-- 1 jay jay 1914 Dec 10 20:17 smbsh.txt drwxrwxr-x 1 jay jay 512 Jana10 03:54 oransntara> /blockquota> p>ForNous most part,ithe f.les andNdiris ories containedpin oueomoubeed smbfs fitesysteLdwiloiwork ju=" likeNany ot e:s, excep for limita aams imposed by oueonaturi of SMB networking. Foriexample, not even the supirusar can performioue opmra aam: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>chown rooe les urisntb>sttt> chown: changien ownership of 'les uris': Opmra aam not pfbmiteedntara> /blockquota> p>because SMB sheris do not intriesicaley suppore oueoidea of ownership. Sosaaoddabehaviors can resacr from this. Foriexample, the command: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>chmod 777 readsa.txtstb>sttt>ntara> /blockquota> p>doesdnot produceaanaerrar messagi, although not ien uas bemn changed. Tue fiteinsmy=>".rr,f.leassa">riadsa.txtstemn stiloiuas pfbmissaamsaset to 664: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>ls -l readsa.txtstb>sttt> -rw-rw-r-- 1 jay jay 131 Jana15 05:01 riadsa.txtstara> /blockquota>

Aside/from lontleoouingsisut> as tue.e, ue moubeed smbfs fitesysteL can be usad in conjuncbiam with virtu,ley any epplicabion, and you might be pleasantly surprisad at uow nicely it inpegrates with your Linux-b".ed compueing environment. You can even crrateasymbolic links in tueaUnixafitesysteL, poibeienpto f.les andNdiris ories inside/SMB sheris. However, unless oue seSeer ispa Sae las Seou ouat suppores UnixaCIFSiextsbsiams, you wiloinot be a te oo crrateaa/symbolic link inside/ ue moubeed smbfs fitesysteL. man htdiv> hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-4.2"/> nh3cond dirhead2">Moubeing smbfs FitesysteLs Automaticaleysth3n p>nt assas"INDEX-58"/nAsiwsth othe: typasaof fitesysteLs, an smbfs fitesysteL can be moubeed automaticaley durien systeL booeup by crratien an sbery foriit in nsmy=>".rr,f.leassa">/etc/fstabstemn.aTue >ormatofor oueosbery ispas follows: man blockquota> pray=>".rr,code">ssmy=>".rr,replacea te">Sheri-UNC moube-poibestemn smbfs ssmy=>".rr,replacea te">opbiamsstemna0 0ntara> /blockquota>

Replace ssmy=>".rr,replacea te">Sheri-UNCstemn with the UNC of tue sheri (usien tue forward s>".h >ormat), and riplace nsmy=>".rr,replacea te">moube-poibestemn with the assaaof the diris ory in tueaLinux fitesysteL onNwhtt> tue sheri wsloibsomoubeed. In place of nsmy=>".rr,replacea te">opbiamsstemn, simply use tue stringithat you usad wsth oue nsmy=>".rr,atShah b">-ostemn flag in oue nsmy=>".rr,atShah b">smbmoubestemn command. man p>Once you have found theaargumsbes to use wsth tue nsmy=>".rr,atShah b">smbmoubestemn command to moube oue sheri tue way you likeNit, it is a eouy simple matbeu oo crrateaoueoebery for nsmy=>".rr,f.leassa">/etc/fstabstemn.aTue nsmy=>".rr,atShah b">smbmoubestemn command we usad to moube oue sheri nsmy=>".rr,f.leassa">\\maya\estemn on nsmy=>".rr,f.leassa">/smb/estemn would oranslate to this nsmy=>".rr,f.leassa">/etc/fstabstemnoebery: man blockquota> pray=>".rr,code">//maya/e /smb/e smbfs crrdrmtoals=/hosa/jay/.smbpw,uid=jay,gid=jay,fmask=664,dmask=775a0 0 it=>".rr,loneannotabion">(Pleaseinotr tuat tuis should aloigo onoone line.)stara> /blockquota> t assas"she l2-CHP-5-NOTE-125"/nnblockquotay=>".rr,nota">WARNING mh4>

If you make a sistake in modofyien nsmy=>".rr,f.leassa">/etc/fstabstemnnt assas"INDEX-59"/nnt assas"INDEX-60"/n, yourasysteL might not rebooe propfbly, and you might be forcad to booe inoo sienle-usar mode to f.x ui pro teL. Bd>ori you edit nsmy=>".rr,f.leassa">/etc/fstabstemn, be sure to make a/backup copyNof it, and beopreperid to ricoveriyourasysteL if any uingigoesdwrong.ntan /blockquota> p>Once oueoebery uas bemn added,Nous systeL wsloiautomaticaley moube tue sheri whmn booeing. Or,Nous systeL administrator can manu,ley moube or unmoube oue sheri wsth commandsisut> as tue.e: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>moube /smb/estb>sttt> # ny t=>".rr,usarinput"> b>umoube /smb/estb>sttt>stara> /blockquota> ".rr,nota">TIP mh4>

Itpisopo di te oo use nsmy=>".rr,atShah b">moubestemn and nsmy=>".rr,atShah b">umoubestemn by givien ouem ohe UNC for oueosheri usien forward s>".hes, as in ouransmy=>".rr,f.leassa">/etc/fstabstemn ebery. However, be cerifut a out tuis. A sheri might be lis"ed mori thanoonce inNnsmy=>".rr,f.leassa">/etc/fstabstemnoso ouat i"acan be moubeed atpmori thanoone place in tueaLinux fitesysteL. If you use oueoUNC to spocicypthe sheri you wishpto moube or unmoube, you might cause ie to be moubeed or unmoubeed atpanot e: moube poibeifrom the one you inpended.ntan /blockquota> htdiv> hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-4.3"/> nh3cond dirhead2">Common smbmoube Opbiamssth3n p>nt hdd>s"ch05.html#she l2-CHP-5-TABLE-1">Ta te 5-1 lis"s nsmy=>".rr,replacea te">keystemnny t=>".rr,lonfbal">=sttt>ssmy=>".rr,replacea te">valuestemn pairs that can be usad wsth oue nsmy=>".rr,atShah b">-ostemn apbiam of nsmy=>".rr,atShah b">smbmoubestemn orpin oue opbiams field of tue nsmy=>".rr,f.leassa">/etc/fstabstemnoebery for oueosmbfs fitesysteL. See oueonsmy=>".rr,atShah b">smbmoubestemn manu,l page for a complete lis"aof opbiams. man t assas"she l2-CHP-5-TABLE-1"/>Ta te 5-1. smbmoube opbiamssth4> ntr> nyh>

Keystan /yh>

Valuestan /yh>

Funcbiamstan /yh> ntr> nyd>

ny t=>".rr,lonfbal">usarassanttt>stan /yd> nyd>

stringstan /yd> nyd>

Providespthe usarassa, and opbiamaley ui pd dword and workgroup, for authemtocatiam.stan /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">pd dwordnttt>stan /yd> nyd>

stringstan /yd> nyd>

Providespthe sheri oridomain pd dword, if it hahn't bemn supplied by anot e: meams. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">crrdrmtoalssttt>stan /yd> nyd>

stringstan /yd> nyd>

Nssaaof fiteicontainien the usarassa and pd dword. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">uidsttt>stan /yd> nyd>

string orinumsricstan /yd> nyd>

Usar ID to apply to atlif.les andNdiris ories of the moubeed sheri. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">gidsttt>stan /yd> nyd>

string orinumsricstan /yd> nyd>

GroupaID to apply to atlif.les andNdiris ories of the moubeed sheri. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">fmasksttt>stan /yd> nyd>

numsricstan /yd> nyd>

Pfbmissaamsato apply to fites. Defaacr i b".ed on current umask. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">dmasksttt>stan /yd> nyd>

numsricstan /yd> nyd>

Pfbmissaamsato apply to diris ories.aDefaacr i b".ed on current umask. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">debugsttt>stan /yd> nyd>

numsricstan /yd> nyd>

Debug level. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">workgroupsttt>stan /yd> nyd>

stringstan /yd> nyd>

Nssaaof workgroupaof remotays Seou. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">gueststtt>stan /yd> nyd>

(none)stan /yd> nyd>

Suppresses pd dword promp . man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">rosttt>stan /yd> nyd>

(none)stan /yd> nyd>

Moube riad-only. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">rwsttt>stan /yd> nyd>

(none)stan /yd> nyd>

Moube riad/write.aTuis is the defaacr. man /yd> n/tr> nyr> nyd>

ny t=>".rr,lonfbal">ttlsttt>stan /yd> nyd>

numsricstan /yd> nyd>

Amoube ofitisa oo cacheNthe contsbes ofidiris ories.aDefaacrsato 1000 ms t assas"INDEX-62"/>. man /yd> n/tr> n/tablen htdiv> htdiv> ndivcond dirsecb1"> t assas"she l2-CHP-5-SECT-5"/> nh2cond dirhead1">smbshsth2n p>Tue nsmy=>".rr,atShah b">smbshstemn t assas"INDEX-63"/n programpisopart of the Sae l suiteaand worksaon sosa, but not all,iUnixav"riabes.nt assas"FNPTR-3"/nnt hdd>s"#FOOTNOTE-3">[3] Effecbively, it adds a wrapperaaround tue usar's command shell, easblien it and common Unix utilonies to work on f.les andNdiris oriespin SMB sheris, in addibion to f.les andNdiris ories in the localaUnixafitesysteL. From the usar's perspic"ive,aoueoeffecb is that of a simulated moube ofitheoSMB sheris onto oue UnixafitesysteL. man p> smy=>".rr,atShah b">smbshstemn worksaby runnien the shellaand arograms rum from ir in an environmentoinNwhtt> cales to oue standard C library eri rrdiris ed to oue nsmy=>".rr,atShah b">smbwrapperstemn t assas"INDEX-64"/n library, whtt> uas suppore for opmra ang on SMB sheris.aTuis rrdiris iam can work only if tue programpbeing run is dyassicaley linked. Foreuastaly, modern Unix vousiams ship wsth most common utilonies linked dyassicaley rathe: thanostaticaley. man t assas"she l2-CHP-5-NOTE-127"/nnblockquotay=>".rr,nota">TIP mh4>

To determini whmt e: a programpisodyassicaley or staticaley linked, ery usien tue smy=>".rr,atShah b">fitestemn command. man /blockquota> p>To use nsmy=>".rr,atShah b">smbshstemn, youraSae l ins"allatiam sust be configured usien tue configure apbiam ny t=>".rr,lonfbal">--wsth-smbwrappersttt>. man p>If you have aanumbar of UnixasysteLs wsth oue sssa host opmra ang systeLdand archites uri andNdon't wan" oo bot e: wsth a futl Sae l ins"allatiam, you can simply move the followien f.les to the ot e: systeLs: man blockquota> pray=>".rr,code">/usr/local/she l/bin/smbsh /usr/local/she l/bin/smbwrapper.so /usr/local/she l/lib/smb.confstara> /blockquota>

Make sure thaeinsmy=>".rr,f.leassa">/usr/local/she l/binstemn isoinNyour shell'sasearch path.aTue nsmy=>".rr,f.leassa">smb.confstemnnt assas"INDEX-65"/nnt assas"INDEX-66"/n fite is neaded only for nsmy=>".rr,atShah b">smbshstemn to determini tue workgroup oridomain andNdoesdnot nead to be ". elaborste as your Sae l s Seou's configurataam fite.nman hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-5.1"/> nh3cond dirhead2">An Inpedas ive Sessaam wsth smbshsth3n p>nt assas"INDEX-67"/nTo start nsmy=>".rr,atShah b">smbshstemn, simply oype in oueonsmy=>".rr,atShah b">smbshstemn command at the shell promp . You wsloibsopromp edpfor a usarassa and pd dword with whtt> to authemtocate on oueoSMB network: man blockquota> pray=>".rr,code">$ ny t=>".rr,usarinput"> b>smbshstb>sttt> Usarassa: davecb Pd dword: smbsh$stara> /blockquota>

Whiteiworking within oueonsmy=>".rr,atShah b">smbshstemn shell, you have a virtu,linsmy=>".rr,f.leassa">/smbstemn diris ory.aTuis doesdnot as u,ley exist in tueaUnixafitesysteL and is supporeed within nsmy=>".rr,atShah b">smbshstemn only oo helpaorganize theoSMB sheris in a strus uri familiar topUnix users. You can lis"athe contsbes ofioue nsmy=>".rr,f.leassa">/smbstemn virtu,lidiris ory and ge a lis"aof workgroups in the localanetwork, whtt> ari also prisebeed as virtu,l diris ories: man blockquota> pray=>".rr,code">smbsh$ ny t=>".rr,usarinput"> b>cd /smb ; lsstb>sttt> ZOOL PLANK BACILstara> /blockquota>

You can change your working diris ory to one ofitheoworkgroupavirtu,l diris ories, and lis"ien one ofitheL wsloisuowitueocomputers in oue workgroup: man blockquota> pray=>".rr,code">smbsh$ ny t=>".rr,usarinput"> b>cd ZOOL ; lsstb>sttt> ANTILLES DODO MILO SEAL ARGON HANGGLIDE OSTRICH SPARTA BALLET INFUSION PLAQUE THEBES CHABLIS JAZ PRAETORIAN TJ COBRA KIKO RAYOPCI TRANCE COUGUR MACHINE-HEADPCI RUMYA VIPERPCI CRUSTY MATHUMA SCOTstara> /blockquota>

Likewi.e, you can change your current diris ory to, and lis" the contsbes of, a computer virtu,lidiris ory,dand then you can s e a lis"ien of sheris of>ared by ouat computer: man blockquota> pray=>".rr,code">smbsh$ ny t=>".rr,usarinput"> b>cd scot ; lsstb>sttt> ADMIN$ davecb nc np2s pl ace dhcp-mrk03 np nps xp cl ep np2 opcomstara> /blockquota>

Thisois the lowis level of nsmy=>".rr,atShah b">smbshstemn's virtu,lidiris ory systeL. Once you nsmy=>".rr,atShah b">cdstemn into a sheri, you ari within oueoSMB sheri on oueoremotaycomputer: man blockquota> pray=>".rr,code">smbsh$ ny t=>".rr,usarinput"> b>cd davecb ; lsstb>sttt> Mail mkanalyh b_dirs.idx SUNWexplo nfs.ps Sent nsmail alesun.html projes s.txt bin sumtisaxstara> /blockquota>

Once inNa remotaysheri, most ofitheoUnixashell utilonies wiloiwork, and you can opmra e on f.les andNdiris oriespmut> as you would am any UnixasysteL. You can even crrateasymbolic links in tueaUnix fitesysteL poibeienpto f.les andNdiris ories in theoSMB sheri. However, atbempts to crrateasymbolic links in tueaSMB sheri wiloifail unless oue sheri isobeing s Seod by Sae l wsth suppore for UnixaCIFS extsbsiams. man htdiv> htdiv> ndivcond dirsecb1"> t assas"she l2-CHP-5-SECT-6"/> nh2cond dirhead1">smbutiloand mount_smbfssth2n p>Tue nsmy=>".rr,atShah b">smbutilstemn and smy=>".rr,atShah b">mount_smbfsstemn programs provideaSMB clisbe funcbiamality for FreeBSD, Darwin, and Mac OS X. Neithe: ofitheoprograms isopart of the Sae l distributaam; however, we eri includien ouem oo give you a lontleoaddibional suppore in caseiyou have BSD-relabed UnixasysteLs on youranetwork.nman hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-6.1"/> nh3cond dirhead2">smbutilsth3n p>The nsmy=>".rr,atShah b">smbutilstemnnt assas"INDEX-68"/n program provides funcbiamality similar to sosaaof the Sae l suite's command-line utilonies. It can be usad to lis"athe sheris available am anaSMB s Seou or pfbformiNetBIOS assa lookups. man p>The firstaargumsbe given to nsmy=>".rr,atShah b">smbutilstemn is one of a numbar of subcommandsiand is usu,ley followed by argumsbes spocicoc oo ohe subcommand. Foriexample, to lis"athe risourcis of>ared by l s Seou, use the nsmy=>".rr,atShah b">viewstemn subcommand, and enteriyour s Seou pd dword when promp ed: man blockquota> pray=>".rr,code">% ny t=>".rr,usarinput"> b>smbutiloview //vamanastb>sttt> Pd dword: Sheri Type Comment ------------------------------------------------------------- public disk SS2500 prinped Stylus Scan 2500 IPC$ pipe IPC S Seice (Sae l 2.2.5) ADMIN$ disk IPC S Seice (Sae l 2.2.5) leonvs disk Usar HosaaDiris ories 5 sheris lis"ed from 5 availablestara> /blockquota>

If you wishpto connecb to oue s Seou wsth a usarassa ouat dif>ars from that on youraclisbe, you can spocicypit onithe command line by pricedien the assaaof the s Seou wsth the usarassa and usien an at rign (ny t=>".rr,lonfbal">@sttt>) as a separstor: man blockquota> pray=>".rr,code">% ny t=>".rr,usarinput"> b>smbutiloview //leonvs@vamanastb>sttt>stara> /blockquota>

You can also include ui pd dword afterithe usarassa, usien a colon (:) as a separstor, to avoidobeing promp edpfor it: man blockquota> pray=>".rr,code">% ny t=>".rr,usarinput"> b>smbutiloview //leonvs:leonspd dword@vamanastb>sttt>stara> /blockquota>

Typing yourapd dword in oue open likeN uis is strongey discouraged. It's a lontleobetbeu if you use an encryp ed pd dword, whtt> you can genmra e usien nsmy=>".rr,atShah b">smbutilstemn's nsmy=>".rr,atShah b">cryp stemn subcommand: man blockquota> pray=>".rr,code">% ny t=>".rr,usarinput"> b>smbutilocryp leonspd dwordstb>sttt> $$1625a5723293f0710e5faffcfc6stara> /blockquota>

Thisocan then be usad in place of a clear-text pd dword. However, oue encryp aam isdnot particularly strong and wiloifoiloonly oueomost casu,liinspic"iam. Asdnoted earlisr,Nous only rrasoasbly secure sathod of providien aapd dword isito beopromp edpfor ie. man p>Whiteistartien up, nsmy=>".rr,atShah b">smbutilstemn riadsNthe fite nsmy=>".rr,f.leassa">.nsmbrcstemnnt assas"INDEX-69"/n inithe usar's hosa diris ory.aAlso,Nthe fite nsmy=>".rr,f.leassa">/usr/local/etc/nsmb.confstemnnt assas"INDEX-70"/nnt assas"INDEX-71"/n is read, andNdiris ives in tuatofite override/ uosi in users' nsmy=>".rr,f.leassa">~/.nsmbrcstemn fites. Thisois to allow administrators to apply manda ory s ttingsito atliusers. Diris ives can be placedpin this fiteiusien the s ctaam and parsmeter >ormatosimilar topthat of oueoSae loconfigurataam fite. A lis"aof common configurataam parsmetersois given inNnt hdd>s"ch05.html#she l2-CHP-5-TABLE-2">Ta te 5-2. man p>Foriexample, to keep yourapd dword in your nsmy=>".rr,f.leassa">~/.nsmbrcstemn fite, you can crrateaanasbery in tue f.leisut> as tue followien: man blockquota> pray=>".rr,code">[VAMANA:LEONVS] pd dword=$$1625a5723293f0710e5faffcfc6stara> /blockquota>

The s ctaam headien in brackies spocicoespthe SMB s Seou's NetBIOS assa and the usarassa ooNwhtt> tue subsequsbe parsmeter s ttingsiapply. (The hostassa and usarassa should be supplied in uppercaseicheracters.) S ctaam headiens can also consis"aof ju=" a hostassa or can contain a sheri assa as a third elamsbe for spocicyienppdrsmetersoepplica te oo a sienle sheri. Fimaley, if a y t=>".rr,lonfbal">[defaacr]sttt> s ctaam isoprisebe, oue settingsiinait apply to atliconnecbiams. man p>The followienaexample nsmy=>".rr,f.leassa">.nsmbrcstemnisuows sosaaof the ot e: pdrsmetersoyou might u.e: man blockquota> pray=>".rr,code">[defaacr] usarassa=leonvs # NetBIOS assa s Seou nbns=192.168.1.3 [VAMANA] # s Seou IPoaddress addr=192.168.1.6 workgroup=TEST [VAMANA:LEONVS] pd dword=$$1625a5723293f0710e5faffcfc6stara> /blockquota>

Anot e: uingiyou can do wsth nsmy=>".rr,atShah b">smbutilstemn is nt assas"INDEX-72"/nnt assas"INDEX-73"/nnt assas"INDEX-74"/noranslate betwemn IPoaddresses oriDNS assas and nt assas"INDEX-75"/nNetBIOS assas. Foriexample, the nsmy=>".rr,atShah b">statusstemn subcommand takes an IPoaddress oriDNS hostassa as an argumsbe and riturns the corrispondien SMB s Seou's NetBIOS assa and workgroup: man blockquota> pray=>".rr,code">% ny t=>".rr,usarinput"> b>smbutilostatus 192.168.1.6stb>sttt> Workgroup: TEST S Seou: VAMANAstara> /blockquota>

The nsmy=>".rr,atShah b">lookupstemn subcommand riturns the IPoaddress ".rociaeed with a given NetBIOS hostassa. A NetBIOS assa s Seou can be opbiamaley spocicoedpwsth oue nsmy=>".rr,atShah b">-wstemnaargumsbe: man blockquota> pray=>".rr,code">% ny t=>".rr,usarinput"> b>smbutilolookup -w 192.168.1.3 VAMANAstb>sttt> Got risponse/from 192.168.1.3 IPoaddress of VAMANA: 192.168.1.6stara> /blockquota> hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-6.2"/> nh3cond dirhead2">mount_smbfssth3n p>The nsmy=>".rr,atShah b">mount_smbfsstemnnt assas"INDEX-76"/n program pfbforms essemtoally oueosssa funcbiam as nsmy=>".rr,atShah b">smbmoubestemn on Linux. Itpmoubes anaSMB sheri on a diris ory in oueolocalafitesysteL. TueoSMB sheri can then be accessedpju=" likeNany ot e:idiris ory,dsubjecb to sosaabehavior,l dif>arences noted earlisr inNnt hdd>s"ch05.html#she l2-CHP-5-SECT-4.1">S ctaam 5.4.1. man p>The command synopsis for nsmy=>".rr,atShah b">mount_smbfsstemn is: man blockquota> pray=>".rr,code">mount_smbfs nsmy=>".rr,replacea te">[opbiams]stemn ssmy=>".rr,replacea te">Sheri-UNCstemn nsmy=>".rr,replacea te">moube-poibestemnstara> /blockquota>

wuedd ssmy=>".rr,replacea te">Sheri-UNCstemn is of the form: man blockquota> pray=>".rr,code">//[ssmy=>".rr,replacea te">workgroupstemn;][ssmy=>".rr,replacea te">usarassantemn[:hsmy=>".rr,replacea te">pd dwordntemn]@]hsmy=>".rr,replacea te">s Seountemn[/hsmy=>".rr,replacea te">sherintemn]ntara> /blockquota> p>ForNexample: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>moube_smbfs '//TEST;leonvs:$$1625a5723293f0710e5faffcfc6@vamana/leonvs' /stb>sttt> \ny t=>".rr,usarinput"> b>Volumss/leonvsstb>sttt>stara> /blockquota>

Theaownership and permissaams of the moube poibeidetermini tue defaacraownership and permissaams for f.les andNdiris ories in the moubeed sheri.aTuese can be modicoedpwsth command-line argumsbes, likeN uis: man blockquota> pray=>".rr,code"># ny t=>".rr,usarinput"> b>moube_smbfs -u leonvs -g admin -f 0750 -d 0755 //leonvs@vamana/leonvs stb>sttt> \ny t=>".rr,usarinput"> b>/Volumss/leonvsstb>sttt>stara> /blockquota>

In uis example, the f.les andNdiris ories in theomoubeed sheri wilo be owned by oueousar leonvs and the groupaadmin, with f.les and diris ories having permissaams 750 and 755, rispic"ively.a(As usu,l, ue pfbmissaamsaeri spocicoedpin oue octal >ormatoused by oueoUnix nsmy=>".rr,atShah b">chmodstemn command.) man p>The nsmy=>".rr,atShah b">mount_smbfsstemnnt assas"INDEX-77"/nnt assas"INDEX-78"/n command also makes usa of settingsiin nsmy=>".rr,f.leassa">/usr/local/etc/nsmb.confstemn and nsmy=>".rr,f.leassa">~/.nsmbrcstemn, as described earlisr. A lis"aof common configurataamppdrsmetersoend command-line opbiams isoprovided inNnt hdd>s"ch05.html#she l2-CHP-5-TABLE-2">Ta te 5-2. man t assas"she l2-CHP-5-TABLE-2"/>Ta te 5-2. Common smbutiloand mount_smbfs opbiamssth4>

ntr> nyh>

Command-line opbiamstan /yh>

Configurataam fiteppdrsmeterstan /yh>

Descrip iamstan /yh> ntr> nyd>

ny t=>".rr,lonfbal">-Isttt> hsmy=>".rr,replacea te">hostassastemnstan /yd> nyd>

ny t=>".rr,lonfbal">addrsttt>stan /yd> nyd>

AvoidoNetBIOS assa risolutaam and connecb to oue s Seou usien the spocicoedpDNS hostassa ou IPoaddress. man /yd> n/tr> nyr> nyd>

-Nstan /yd> nyd>

nsmy=>".rr,atShah b">nonestemnstan /yd> nyd>

Dodnot promp for aapd dword. man /yd> n/tr> nyr> nyd>

-R hsmy=>".rr,replacea te">coubestemnntan /yd> nyd>

ny t=>".rr,lonfbal">ritry_coubesttt>stan /yd> nyd>

Numbar of tisas to riery connecbiam bd>ori givien up. man /yd> n/tr> nyr> nyd>

-T hsmy=>".rr,replacea te">s condsstemnntan /yd> nyd>

ny t=>".rr,lonfbal">tisaouesttt>stan /yd> nyd>

Tisaoue, in s conds, pfb connecbiam requssr. man /yd> n/tr> nyr> nyd>

-U ssmy=>".rr,replacea te">usarassantemnntan /yd> nyd>

ny t=>".rr,lonfbal">usarassanttt>stan /yd> nyd>

Usarassa ooNusa for authemtocatiam.aDefaacrsato Unix userassa. man /yd> n/tr> nyr> nyd>

-W ssmy=>".rr,replacea te">workgroupstemnntan /yd> nyd>

ny t=>".rr,lonfbal">workgroupsttt>stan /yd> nyd>

Nssaaof workgroupaof remotays Seou. man /yd> n/tr> nyr> nyd>

-d nsmy=>".rr,replacea te">modantemnntan /yd> nyd>

nsmy=>".rr,atShah b">nonestemnstan /yd> nyd>

Pfbmissaamsato apply to diris ories in theomoubeed sheri.aDefaacrsato oue sssa asNthe fite pfbmissaams, plus anaexecute (search) bit wheneverithe read bit is set. man /yd> n/tr> nyr> nyd>

-f nsmy=>".rr,replacea te">modantemnntan /yd> nyd>

nsmy=>".rr,f.leassa">nonestemnstan /yd> nyd>

Pfbmissaamsato apply to f.les inatheomoubeed sheri.aDefaacrsato the sssa asNthe pfbmissaamsaset onithe diris ory used as oue moube poibe. man /yd> n/tr> nyr> nyd>

-g nsmy=>".rr,replacea te">groupstemnntan /yd> nyd>

nsmy=>".rr,atShah b">nonestemnstan /yd> nyd>

Nssa ou numsric GID to apply to atlif.les andNdiris ories in the moubeed sheri.aDefaacrsato the groupaof the diris ory used as oue moube poibe. man /yd> n/tr> nyr> nyd>

-n nsmy=>".rr,replacea te">longstemnntan /yd> nyd>

nsmy=>".rr,atShah b">nonestemnstan /yd> nyd>

Disable suppore for long f.leassas. Restrict f.leassasato 8.3 assang standard. man /yd> n/tr> nyr> nyd>

-u ssmy=>".rr,replacea te">usarassantemnntan /yd> nyd>

nsmy=>".rr,atShah b">nonestemnstan /yd> nyd>

Usarassa ou numsric UID to apply as oue owner of all f.les and diris ories inatheomoubeed sheri.aDefaacrsato the owner of tue diris ory used as oue moube poibe. man /yd> n/tr> nyr> nyd>

-w hsmy=>".rr,replacea te">hostassastemnstan /yd> nyd>

ny t=>".rr,lonfbal">nbnssttt>stan /yd> nyd>

Hostassa ou IPoaddressaof the NetBIOS assa s Seou. man /yd> n/tr> nyr> nyd>

nsmy=>".rr,atShah b">nonestemnstan /yd> nyd>

ny t=>".rr,lonfbal">pd dwordnttt>stan /yd> nyd>

Pd dword ooNusa for authemtocatiam. man /yd> n/tr> n/tablen htdiv> hdivcond dirsecb2"> t assas"she l2-CHP-5-SECT-6.3"/> nh3cond dirhead2">Mac OS Xsth3n p>nt assas"INDEX-79"/nIn addibion to nsmy=>".rr,atShah b">smbutilstemn and smy=>".rr,atShah b">mount_smbfsstemn, OS X includes a graphocalpinpedface to the funcbiamality tuey provide. To use uis inpedface, open the Go menu and s lecb the Connecb to S Seou . . . menu iteL. Ins"ead of usien aaUNC, spocicypthe sheri in oueoformiof a UniformiRisourci Idrmtofisr (URI) with a pdd>ix of ny t=>".rr,lonfbal">smb://sttt> enteredpin oue Addressafield, as shown in nt hdd>s"ch05.html#she l2-CHP-5-FIG-5">Figure 5-5. man divcond dirfigure"> t assas"she l2-CHP-5-FIG-5"/>Figure 5-5. OS X Connecb to S Seou dialog mh4>

You can spocicyplas Seou,ysheri, workgroup, usarassa, and pd dword (opbiamaley encryp ed wsth nsmy=>".rr,atShah b">smbutil cryp stemn) in the URI,pin oueosssa >ormatoas oue UNC argumsbe to smy=>".rr,atShah b">mount_smbfsstemn. If you don't spocicyplasheri assa in tueaURI,pyou wsloibsoshown l wsndowiouat lets you choose/from a lis"aof sheris available to moube. See nt hdd>s"ch05.html#she l2-CHP-5-FIG-6">Figure 5-6. man divcond dirfigure"> t assas"she l2-CHP-5-FIG-6"/>Figure 5-6. Selecbienpa sheri to moubesth4>

Only guest-accessi te sheris wsloisuowiupain oueolis"aubeil you've authemtocated. Afteripressien the Authemtocate buttam, you'loibsopromp edpfor a workgroup, usarassa, and pd dword, as shown in nt hdd>s"ch05.html#she l2-CHP-5-FIG-7">Figure 5-7. You'loialso s e uis dialog if you providealasheri assa in tueaURI,pbut not a usarassa and pd dword. t assas"FNPTR-4"/nnt hdd>s"#FOOTNOTE-4">[4] man divcond dirfigure"> t assas"she l2-CHP-5-FIG-7"/>Figure 5-7. Clisbe authemtocatiamsth4>

As usu,lpfor Mac OS X, sheris areomoubeed under nsmy=>".rr,f.leassa">/Volumssstemn, but suowiupain oueorooe of the Finder hisrarchy. man p>If you have aaWINS s Seou on youranetwork, you can provideaoue seSeer'siIPoaddressain oueoDiris ory Access epplicabion, oriby usien tue y t=>".rr,lonfbal">winssttt> ny t=>".rr,lonfbal">s Seounttt> parsmeter in nsmy=>".rr,f.leassa">/etc/smb.confstemn. man p>If you don't knowitueoassaaof las Seou oo whtt> you wishpto connecb, you can look foriit initueobrowseolis", usien the graphocalpfronpend to the nsmy=>".rr,atShah b">nmblookupstemn command provided wsth Sae l. Click the downward-poibeienparrow initueoConnecb to S Seou . . . dialog box to suowit hisrarchocal, column-b".ed view of available workgroups and s Seous,osimilar topthat shown in nt hdd>s"ch05.html#she l2-CHP-5-FIG-8">Figure 5-8. If youraclisbe is also acbienpas anaSMBofite s Seou,yit won't suowiupain ies ownobrowse lis".nt assas"INDEX-80"/nnman divcond dirfigure"> t assas"she l2-CHP-5-FIG-8"/nnt assas"INDEX-81"/>Figure 5-8. Browsien the aetworksth4> htdiv> htdiv>


Fooenotessth4> t assas"FOOTNOTE-1"/n p>nt hdd>s"#FNPTR-1">[1] An altaras ive topextracbien oueotar archive diris ly to the SMB sheri is to use oueoUnix systeL's nsmy=>".rr,atShah b">tarstemn command to extracb ie to a diris ory on oueoUnixas Seou, uen copyNthe desiredpfite(s) to a sherid diris ory.aTuis allows a grrater amoube oficontrol over the ristorataampprocess, as wuen correcbienpfor an accidemtalafite delebiam or riverbienpa setaof f.les to a previous conditiam. man t assas"FOOTNOTE-2"/n p>nt hdd>s"#FNPTR-2">[2] Sae loVousiams 2.2.4 and later have suppore for UnixaCIFSiextsbsiams developed by Hewlebt-Packard, whtt> add futl suppore for Unixaownership, group, and pfbmissaamsain smbfs fitesysteLs wuen sherid betwemn owo Sae l systeLs. You wsloialso nead a recentovousiamaof smbfs in your Linux karael. man t assas"FOOTNOTE-3"/n p>nt hdd>s"#FNPTR-3">[3] A" the tisa of this wribien,onsmy=>".rr,atShah b">smbshstemn doesdnot work on HP/UX or Linux. However, Linux suppore might riturn in tue future. man t assas"FOOTNOTE-4"/n p>nt hdd>s"#FNPTR-4">[4] If you've previously stored your authemtocatiam in>ormatiam in a Keychain,pyou wslo ins"ead bsopromp edpfor your Keychainapd dword. man /blockquota>
nt hdd>s"toc.html">TOC mh4> mhtml>